using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class ItemDetails
{
    public int itemID;
    public string itemName;
    public ItemType itemType;
    public Sprite itemIcon;

    private Sprite _itemOnWorldSprite;
    public Sprite itemOnWorldSprite
    {
        get
        {
            if (_itemOnWorldSprite == null)
            {
                _itemOnWorldSprite = itemIcon;
            }
            return _itemOnWorldSprite;
        }
        set
        {
            _itemOnWorldSprite = value;
        }
    }


    public string itemDescription;
    public int itemUseRadius = 1;//使用范围
    public bool canPickup = true;//能捡起
    public bool canDropItem = true;//能丢弃
    public bool canCarried = true;//能举起
    public int itemPrice;
    [Range(0, 1)]
    public float sellPercentage;
}


[Serializable]
public class InventoryItem
{
    public int itemID;
    public int itemAmount;//数量，避免删除
}





[Serializable]
public class SceneItem
{
    public int itemID;
    public SerializableVector3 position;
}

[Serializable]
public class ScenneFurniture
{
    public int itemID;
    public SerializableVector3 position;

    public int boxIndex;
}


/// <summary>
/// 网格的属性
/// </summary>
[Serializable]
public class TileProperty
{
    public Vector2Int tilePosition;
    public GridType gridType;
    /// <summary>
    /// 具体的值，决定该地块是否允许
    /// </summary>
    public bool boolTypeValue;
}


[Serializable]
public class TileDetails
{
    /// <summary>
    /// 位置和  unity 的tilemap是对应的
    /// </summary>
    public int gridX, gridY;
    public GridType gridType;
    public bool canDig;
    public bool canDropItem;
    public bool canFurniture;
    public bool isNPCObstacle;

    /// <summary>
    /// 挖坑后过了多少天
    /// </summary>
    public int daysSinceDig = -1;
    public int daysSinceWatered = -1;
    public int seedItemID = -1;
    /// <summary>
    /// 生长天数    和种子所需生长天数是分开的，好
    /// </summary>
    public int growthDays = -1;
    /// <summary>
    /// 收货次数
    /// </summary>
    public int daysSinceLastHarvest = -1;

    // 销毁坑
    public void DestroyDig()
    {
        this.daysSinceDig = -1;
        this.canDig = true;
        this.canDropItem = true;
        this.growthDays = -1;
    }
}


[Serializable]
public class NpcPosition
{
    public Transform npc;
    public string startScene;
    public Vector3 position;
}


//场景路径
[Serializable]
public class SceneRoute
{
    [SceneName] public string fromScene;
    [SceneName] public string toScene;
    public List<ScenePath> pathList = new List<ScenePath>();
}
[Serializable]
public class ScenePath
{
     [SceneName] public string sceneName;
    public Vector2Int fromCell;
    public Vector2Int toCell;
}